From: Jan Beulich Date: Tue, 1 Apr 2014 14:49:18 +0000 (+0200) Subject: VMX: fix PAT value seen by guest X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5306^2~4 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=fce79f8ce91dc45f3a4d699ee67c49e6cbeb1197;p=xen.git VMX: fix PAT value seen by guest The XSA-60 fixes introduced a window during which the guest PAT gets forced to all zeros. This shouldn't be visible to the guest. Therefore we need to intercept PAT MSR accesses during that time period. Signed-off-by: Jan Beulich Reviewed-by: Liu Jinsong --- diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 94f3db2d5f..77ce167872 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -1033,6 +1033,8 @@ static void vmx_handle_cd(struct vcpu *v, unsigned long value) vmx_get_guest_pat(v, pat); vmx_set_guest_pat(v, uc_pat); + vmx_enable_intercept_for_msr(v, MSR_IA32_CR_PAT, + MSR_TYPE_R | MSR_TYPE_W); wbinvd(); /* flush possibly polluted cache */ hvm_asid_flush_vcpu(v); /* invalidate memory type cached in TLB */ @@ -1042,6 +1044,9 @@ static void vmx_handle_cd(struct vcpu *v, unsigned long value) { v->arch.hvm_vcpu.cache_mode = NORMAL_CACHE_MODE; vmx_set_guest_pat(v, *pat); + if ( !iommu_enabled || iommu_snoop ) + vmx_disable_intercept_for_msr(v, MSR_IA32_CR_PAT, + MSR_TYPE_R | MSR_TYPE_W); hvm_asid_flush_vcpu(v); /* no need to flush cache */ } }